package com.track;

import com.track.utils.ShellExecutor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@SpringBootApplication
public class MaintenanceTrackApplication {

    @PostMapping("/remote/exec")
    public String remoteExec(@RequestBody Map<String, String> params) {
        String command = params.get("command");
        return ShellExecutor.exec(command);
    }

    public static void main(String[] args) {
        SpringApplication.run(MaintenanceTrackApplication.class, args);
    }

}
